/*
 * @Copyright: 2017 www.yyfax.com Inc. All rights reserved.
 */
package com.jaws.core.common.vo;

import java.io.Serializable;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import io.swagger.annotations.ApiModelProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;

/**
 * 请求包封装
 *
 * @author maojian
 * @date 2017-04-11 13:57:54
 * @since v1.0.0
 */
@SuppressWarnings("serial")
public class OpRequest<P> implements Serializable {

	protected Logger logger = LoggerFactory.getLogger(getClass());

	/**
	 * 签名参数,用于YYPayApiReq本身和Params里面的参数合起来按前面算法签名后的结果.
	 */
	@ApiModelProperty(value = "签名", allowEmptyValue = true)
	private String sign;
	
	/**
	 * 扩展字段，主要用于扩展业务通用的字段，例如sign，ip，token
	 */
	@ApiModelProperty(value = "扩展字段", allowEmptyValue = true)
	private String ext;

	/**
	 * 参数列表
	 */
	@ApiModelProperty(value = "请求参数", required = true)
	@Valid
	@NotNull
	private P params;

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public P getParams() {
		return params;
	}

	public void setParams(P params) {
		this.params = params;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}

	public String getExt() {
		return ext;
	}

	public void setExt(String ext) {
		this.ext = ext;
	}

	public static void main(String[] args) {
		OpRequest<String> op = new OpRequest<String>();
		op.setParams("123");
		System.out.println(op);
	}
}
